package bill.study.concurrency.confinement;

import java.util.Random;

final public class UserHolder {
	private UserHolder() {
	}

	private static ThreadLocal<User> ThreadLocalUser = new ThreadLocal<User>() {

		protected synchronized User initialValue() {
			User user = new User("bill" + new Random().nextInt(100), "liu"
					+ Thread.currentThread().getName(), 9);
			;
			return user;
		}
	};

	public static User getUser() {
		return ThreadLocalUser.get();
	}
}
